package com.weipt.juc.function;

import java.util.function.Function;

/**
 * @author peter.wei 2020/09/28 14:27
 * @version 1.0
 * @company 终生学习
 * @description <br>peter.wei 2020/09/28 14:27
 *
 *
 * 传入参数，然后返回
 **/
public class TestFunction {
    public static void main(String[] args) {
        Function<String, String> innerFunction = new Function<String, String>() {
            @Override
            public String apply(String s) {
                return s+"ok";
            }
        };
        String apply = innerFunction.apply("111");
        System.out.println(apply);


        Function<String, String> function = (t)->t+"OK";
        System.out.println(function.apply("111"));


        System.out.println(test((t) -> t+"ok", "111"));
    }

    private static String test(Function<String, String> function, String a){
        return function.apply(a);
    }
}